function [Q,score,hessian] = objectFuncQML_ForOptim(paramsValues,setupFilter)
if setupFilter.MEXon == 1 && (setupFilter.optim == 1 || setupFilter.optim == 2)
    if isfield(setupFilter,'transformParamsOn') == 1
        printToScreen(unTransformParams(paramsValues,setupFilter.lowerBoundsValues,setupFilter.upperBoundsValues));
    else
        printToScreen(paramsValues)
    end
end
if setupFilter.optim == 3
    % MMAs implementation of gradient based optimizer
    [Q,errorMes,model,setupFilter,outFilter] = objectFuncQML(paramsValues,setupFilter);
    if errorMes == 0
        stepOption = 1; %1 for one-sided derivatives
        %stepOption = 2; %2 for two-sided derivatives
        [hessian,scoreQML,scoreSMM] = getScoreHessian(paramsValues,setupFilter,outFilter,stepOption);
        score = scoreQML+scoreSMM;
    else
        score   = NaN(length(paramsValues),1);
        hessian = NaN(length(paramsValues),length(paramsValues));
        Q = 1D35;
    end
else
    % Non-gradient based optimizer
    [Q,errorMes,model,setupFilter,outFilter] = objectFuncQML(paramsValues,setupFilter);
    if errorMes ~= 0
        Q = NaN;
    end
end

